window.pageTools = window.pageTools || {};
(function () {
    class Nav {
        constructor(selector, datas,fn) {
            this.datas = datas || []
            this.width = 1226
            this.fn = fn
            this.selector = $(selector || "")
            this.createView()
            
        }
        createView() {
            let nav = $(`
            <ul class='nav'>
            </ul>`)
            this.datas.forEach(info => {
                let item = $(`
                <div class="nav_item" style="width:${this.width / this.datas.length}px">
                <a href="${info.url}">
                    <img src="${info.imageUrl}" alt="">
                    <span>${info.title}</span>
                </a>
                </div>
                `)
                nav.append(item)
            })
            this.selector.append(nav)
            
        }
    }
    window.pageTools.Nav = Nav
})()